jQuery(document).ready(function() {
	resizeIframe();
	
	jQuery(window).on("resize", function(event){
		resizeIframe();
	});

	jQuery("#btn_print").show();
	
	jQuery("#btn_print").click(function(e) {
		// print summary
		e.preventDefault();
		
		template_url = baseurl.replace("/index.php/", "/");
		
		html_container = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns:fb="http://ogp.me/ns/fb#"><head>';
		html_container += '<link rel="stylesheet" type="text/css" href="'+template_url+'skin/css/jquery-ui.css" />';
		html_container += '<link rel="stylesheet" type="text/css" href="'+template_url+'skin/css/custom.css">';
		html_container += '<link rel="stylesheet" type="text/css" href="'+template_url+'skin/css/flux-1_2.css">';
		html_container += '<link rel="stylesheet" type="text/css" href="'+template_url+'skin/css/globelogoshow.css">';		
		
		if (navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0) 
			html_container += '<link rel="stylesheet" type="text/css" href="'+template_url+'skin/css/safari.css">';
		else
			html_container += '<link rel="stylesheet" type="text/css" href="'+template_url+'skin/css/maitai.css">';
			
		html_container += '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><meta name="apple-mobile-web-app-capable" content="yes">';
		html_container += '</head><body>';
		
		jQuery("#footnote").remove(); 
		var body = jQuery("#orderSummary").html();
		myWindow=window.open('','','width=500,height=500,scrollbars=yes,location=no');
		myWindow.document.write(html_container);
		myWindow.document.write(body);
		myWindow.document.write("</body></html>");
		myWindow.document.close(); //missing code

		setTimeout(function(){
		myWindow.focus();
		myWindow.print();		
		}, 3000);
		
	});
});